package com.zhuidian.mothernote.fragment;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.base.decoration.LinearLayoutDecoration;
import com.base.listener.ItemClickListener;
import com.base.presenter.BasePresenter;
import com.zhuidian.mothernote.R;
import com.zhuidian.mothernote.activity.LabelActivity;
import com.zhuidian.mothernote.adapter.SubscribeAdapter;
import com.zhuidian.mothernote.global.BaseFragment;
import com.zhuidian.mothernote.presenter.SubScribePresenter;

public class SubscribeFragment extends BaseFragment<SubScribePresenter> {

    private SubscribeAdapter adapter;
    private SubScribePresenter subScribePresenter;

    @Override
    protected int inflateMainLayoutId() {
        return R.layout.fragment_subscribe;
    }

    @SuppressLint("WrongConstant")
    @Override
    protected void initView(View view) {
        RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
        recyclerView.setHasFixedSize(true);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
        linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        recyclerView.setLayoutManager(linearLayoutManager);
        recyclerView.addItemDecoration(new LinearLayoutDecoration(context));
        adapter = new SubscribeAdapter(context);
        adapter.setOnClickListener(this);
        View footView = adapter.setFootView(R.layout.subscribe_foot);
        TextView tv_check_more_label = (TextView) footView.findViewById(R.id.tv_check_more_label);
        tv_check_more_label.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                context.startActivity(new Intent(context, LabelActivity.class));
            }
        });
        adapter.setItemClickListener(new ItemClickListener() {
            @Override
            public void onItemClick(View view, int position) {

            }
        });
        recyclerView.setAdapter(adapter);
    }

    @Override
    protected void setListener() {

    }

    @Override
    protected void initValue() {

    }

    @Override
    protected BasePresenter getPresenter() {
        subScribePresenter = new SubScribePresenter();
        return subScribePresenter;
    }

    @Override
    public void onClick(View view) {

    }
}
